import { LoginModel, ObjectResponse } from '@/bean/xhr';
import { UserDTO } from '@/bean/dto';
import ajax from '.';

class UserService {
  public login(params: LoginModel) {
    return ajax.put<ObjectResponse<UserDTO>>('/user/login', params);
  }

  public current() {
    return ajax.get<ObjectResponse<UserDTO>>('/user/current');
  }

  public logout() {
    return ajax.put('/user/logout');
  }
}

export const userService = new UserService();
